|
1
|
|
|
import { Link } from "gatsby"; |
|
2
|
|
|
import { PropTypes } from "prop-types"; |
|
3
|
|
|
import React, { Component } from "react"; |
|
4
|
|
|
|
|
5
|
|
|
import { PlayerMinimal } from "./objects/player"; |
|
6
|
|
|
import "./player--featured.scss"; |
|
7
|
|
|
|
|
8
|
|
|
class PlayerFeatured extends Component { |
|
9
|
|
|
renderPlayerHeader = () => ( |
|
10
|
|
|
<header className={`player--featured__header`}> |
|
11
|
|
|
<div className={`bg-green-mask--horizontal`}> |
|
12
|
|
|
<div |
|
13
|
|
|
className={`player--featured__bg-avatar`} |
|
14
|
|
|
style={{ backgroundImage: `url(${this.props.player.imageSrc})` }} |
|
15
|
|
|
/> |
|
16
|
|
|
<div className={`bg-white-end`} /> |
|
17
|
|
|
</div> |
|
18
|
|
|
</header> |
|
19
|
|
|
); |
|
20
|
|
|
renderPlayerStats = () => ( |
|
21
|
|
|
<aside className={`player--featured__statistics`}> |
|
22
|
|
|
{this.renderGamesPlayed(this.props.player.gamesPlayed)} |
|
23
|
|
|
|
|
24
|
|
|
{this.props.player.position === `k` && |
|
25
|
|
|
this.renderCleansheets(this.props.player.cleanSheets)} |
|
26
|
|
|
|
|
27
|
|
|
{this.props.player.position !== `k` && |
|
28
|
|
|
this.renderGoals(this.props.player.goalsScored)} |
|
29
|
|
|
|
|
30
|
|
|
{this.renderCards(this.props.player.cardsYellow, `yellow`)} |
|
31
|
|
|
{this.renderCards(this.props.player.cardsRed, `red`)} |
|
32
|
|
|
</aside> |
|
33
|
|
|
); |
|
34
|
|
|
renderPlayerLink = () => ( |
|
35
|
|
|
<footer className={`player--featured__footer`}> |
|
36
|
|
|
<Link to={this.props.player.link} className="rich-link"> |
|
37
|
|
|
Meer over {this.props.player.nameFirst} » |
|
38
|
|
|
</Link> |
|
39
|
|
|
</footer> |
|
40
|
|
|
); |
|
41
|
|
|
renderPlayerName = () => ( |
|
42
|
|
|
<div className={`player--featured__name__wrapper`}> |
|
43
|
|
|
<h1 className={`player--featured__name`}> |
|
44
|
|
|
<span className={`player--featured__name-first`}> |
|
45
|
|
|
{this.props.player.nameFirst || `John`} |
|
46
|
|
|
</span> |
|
47
|
|
|
<span className={`player--featured__name-last`}> |
|
48
|
|
|
{this.props.player.nameLast || `Doe`} |
|
49
|
|
|
</span> |
|
50
|
|
|
</h1> |
|
51
|
|
|
<div className={`player--featured__bg-shirt-number`} aria-hidden="true"> |
|
52
|
|
|
{this.props.player.shirtNr || `0`} |
|
53
|
|
|
</div> |
|
54
|
|
|
</div> |
|
55
|
|
|
); |
|
56
|
|
|
renderGamesPlayed = (gamesPlayed) => ( |
|
57
|
|
|
<section className={`player--featured__statistics-item`}> |
|
58
|
|
|
<div className={`player--featured__statistics-item__number`}> |
|
59
|
|
|
{gamesPlayed || `0`} |
|
60
|
|
|
</div> |
|
61
|
|
|
<div className={`player--featured__statistics-item__label`}> |
|
62
|
|
|
Wedstrijden |
|
63
|
|
|
</div> |
|
64
|
|
|
</section> |
|
65
|
|
|
); |
|
66
|
|
|
renderCleansheets = (cleanSheets) => ( |
|
67
|
|
|
<section className={`player--featured__statistics-item`}> |
|
68
|
|
|
<div className={`player--featured__statistics-item__number`}> |
|
69
|
|
|
{cleanSheets || `0`} |
|
70
|
|
|
</div> |
|
71
|
|
|
<div className={`player--featured__statistics-item__label`}> |
|
72
|
|
|
Cleansheets |
|
73
|
|
|
</div> |
|
74
|
|
|
</section> |
|
75
|
|
|
); |
|
76
|
|
|
renderGoals = (goalsScored) => ( |
|
77
|
|
|
<section className={`player--featured__statistics-item`}> |
|
78
|
|
|
<div className={`player--featured__statistics-item__number`}> |
|
79
|
|
|
{goalsScored || `0`} |
|
80
|
|
|
</div> |
|
81
|
|
|
<div className={`player--featured__statistics-item__label`}> |
|
82
|
|
|
Doelpunten |
|
83
|
|
|
</div> |
|
84
|
|
|
</section> |
|
85
|
|
|
); |
|
86
|
|
|
|
|
87
|
|
|
renderCards = (cards, color) => ( |
|
88
|
|
|
<section |
|
89
|
|
|
className={`player--featured__statistics-item player--featured__statistics-item--cards`} |
|
90
|
|
|
> |
|
91
|
|
|
<div className={`player--featured__statistics-item__number`}> |
|
92
|
|
|
{cards || `0`} |
|
93
|
|
|
</div> |
|
94
|
|
|
<div className={`player--featured__statistics-item__label`}> |
|
95
|
|
|
<span className={`stats__card stats__card--${color}`}></span> |
|
96
|
|
|
</div> |
|
97
|
|
|
</section> |
|
98
|
|
|
); |
|
99
|
|
|
|
|
100
|
|
|
render() { |
|
101
|
|
|
return ( |
|
102
|
|
|
<article className={`player--featured`}> |
|
103
|
|
|
{this.renderPlayerHeader()} |
|
104
|
|
|
<section className={`player--featured__content`}> |
|
105
|
|
|
{this.renderPlayerName()} |
|
106
|
|
|
{this.renderPlayerStats()} |
|
107
|
|
|
{this.props.player.link && this.renderPlayerLink()} |
|
108
|
|
|
</section> |
|
109
|
|
|
</article> |
|
110
|
|
|
); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
PlayerFeatured.propTypes = { |
|
115
|
|
|
player: PropTypes.instanceOf(PlayerMinimal).isRequired, |
|
116
|
|
|
}; |
|
117
|
|
|
|
|
118
|
|
|
export default PlayerFeatured; |
|
119
|
|
|
|